import ajax from '../utils/ajax.js'
import store from 'store'

// 查询本人购物车列表
export const getCart = (data) => {
	return ajax({
		url: `/base/user/cart/list`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		data
	})
}

// 添加商品到购物车
export const addCart = (data) => {
	return ajax({
		url: `/base/user/cart`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		data,
		method: 'POST'
	})
}

// 购物车减少
export const reduceCart = (data) => {
	return ajax({
		url: `/base/user/cart`,
		header: {
			authentication: store.getters.getUserInfo.token
		},
		data,
		method: 'DELETE'
	})
}